<?php

class PaymentCouponCode extends PaymentBidPack{

	public $couponCode;
	
	public function __construct(){
		$this->setName('bidPack');
	}
	
	public function setCouponCode($couponCode){
		$couponCodeInfo = CouponCode::model()->find('coupon_code = "'.$couponCode.'"');
		if(!empty($couponCodeInfo)){
			$this->bidPackId = $couponCodeInfo->id;
 			$this->bidPackPrice = $couponCodeInfo->cost_price;
 			$this->bidPackTitle = $couponCode;
 			$this->couponCode = $couponCode;
 			$this->amount = $couponCodeInfo->real_bids;
 			$this->bonus = $couponCodeInfo->promo_bids;
		}
	}
		
	public function toArray(){
		return array(
				'bidPackId' 	=> $this->bidPackId,
				'bidPackPrice'	=> $this->bidPackPrice,
				'amount'	=> $this->amount,
				'bonus'	=> $this->bonus,
				'bidPackTitle' => $this->bidPackTitle,
				'couponCode' => $this->couponCode
		);	
	}
}